package com.gewu.pm.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.gewu.pm.R;
import com.gewu.pm.app.AppAdapter;
import com.gewu.pm.bean.MeItemBean;


/**
 * 我的界面 按钮列表
 */
public final class MeItemAdapter extends AppAdapter<MeItemBean> {

    public MeItemAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<MeItemBean>.ViewHolder {

        private final ImageView imgLabel;
        private final TextView tvName;

        ViewHolder() {
            super(R.layout.item_me);
            imgLabel = findViewById(R.id.img_label);
            tvName = findViewById(R.id.tv_name);
        }

        @Override
        public void onBindView(int position) {
            MeItemBean bean = getItem(position);
            imgLabel.setBackgroundResource(bean.getImage());
            //GlideUtils.loadImageView(getContext(),bean.getImage(),imgLabel);
            tvName.setText(bean.getName());
        }
    }
}